const InfoList = require('../models/infoList');
let index = async ctx=>{
    let data =  await InfoList.find({});
    await ctx.render('index',{data:data});
}
let doAdd = async ctx=>{
    let {name,tel,email,other}= ctx.request.body;
    let data = new InfoList({
        name,
        tel,
        email,
        other
    })
    data.save(err=>{
        if(err) throw(err)
    })
    await ctx.redirect("/");
}
module.exports = {
    index,
    doAdd
}